\(\int \cot ^3(e+f x) (a+b \sec ^2(e+f x)) \, dx\) [315]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 32 \[ \int \cot ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {(a+b) \csc ^2(e+f x)}{2 f}-\frac {a \log (\sin (e+f x))}{f} \]

[Out]

-1/2*(a+b)*csc(f*x+e)^2/f-a*ln(sin(f*x+e))/f

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {4223, 455, 45} \[ \int \cot ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {(a+b) \csc ^2(e+f x)}{2 f}-\frac {a \log (\sin (e+f x))}{f} \]

[In]

Int[Cot[e + f*x]^3*(a + b*Sec[e + f*x]^2),x]

[Out]

-1/2*((a + b)*Csc[e + f*x]^2)/f - (a*Log[Sin[e + f*x]])/f

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 455

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] && NeQ[b*c - a*d, 0] && EqQ[m
- n + 1, 0]

Rule 4223

Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*tan[(e_.) + (f_.)*(x_)]^(m_.), x_Symbol] :> Module[{ff =
 FreeFactors[Cos[e + f*x], x]}, Dist[-(f*ff^(m + n*p - 1))^(-1), Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*((b + a*
(ff*x)^n)^p/x^(m + n*p)), x], x, Cos[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[(m - 1)/2] &&
IntegerQ[n] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \frac {x \left (b+a x^2\right )}{\left (1-x^2\right )^2} \, dx,x,\cos (e+f x)\right )}{f} \\ & = -\frac {\text {Subst}\left (\int \frac {b+a x}{(1-x)^2} \, dx,x,\cos ^2(e+f x)\right )}{2 f} \\ & = -\frac {\text {Subst}\left (\int \left (\frac {a+b}{(-1+x)^2}+\frac {a}{-1+x}\right ) \, dx,x,\cos ^2(e+f x)\right )}{2 f} \\ & = -\frac {(a+b) \csc ^2(e+f x)}{2 f}-\frac {a \log (\sin (e+f x))}{f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.18 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.62 \[ \int \cot ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {b \csc ^2(e+f x)}{2 f}-\frac {a \left (\cot ^2(e+f x)+2 \log (\cos (e+f x))+2 \log (\tan (e+f x))\right )}{2 f} \]

[In]

Integrate[Cot[e + f*x]^3*(a + b*Sec[e + f*x]^2),x]

[Out]

-1/2*(b*Csc[e + f*x]^2)/f - (a*(Cot[e + f*x]^2 + 2*Log[Cos[e + f*x]] + 2*Log[Tan[e + f*x]]))/(2*f)

Maple [A] (verified)

Time = 0.58 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.22

method result size
derivativedivides \(\frac {a \left (-\frac {\cot \left (f x +e \right )^{2}}{2}-\ln \left (\sin \left (f x +e \right )\right )\right )-\frac {b}{2 \sin \left (f x +e \right )^{2}}}{f}\) \(39\)
default \(\frac {a \left (-\frac {\cot \left (f x +e \right )^{2}}{2}-\ln \left (\sin \left (f x +e \right )\right )\right )-\frac {b}{2 \sin \left (f x +e \right )^{2}}}{f}\) \(39\)
risch \(i a x +\frac {2 i a e}{f}+\frac {2 \left (a +b \right ) {\mathrm e}^{2 i \left (f x +e \right )}}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{2}}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right ) a}{f}\) \(63\)

[In]

int(cot(f*x+e)^3*(a+b*sec(f*x+e)^2),x,method=_RETURNVERBOSE)

[Out]

1/f*(a*(-1/2*cot(f*x+e)^2-ln(sin(f*x+e)))-1/2*b/sin(f*x+e)^2)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.56 \[ \int \cot ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {2 \, {\left (a \cos \left (f x + e\right )^{2} - a\right )} \log \left (\frac {1}{2} \, \sin \left (f x + e\right )\right ) - a - b}{2 \, {\left (f \cos \left (f x + e\right )^{2} - f\right )}} \]

[In]

integrate(cot(f*x+e)^3*(a+b*sec(f*x+e)^2),x, algorithm="fricas")

[Out]

-1/2*(2*(a*cos(f*x + e)^2 - a)*log(1/2*sin(f*x + e)) - a - b)/(f*cos(f*x + e)^2 - f)

Sympy [F]

\[ \int \cot ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\int \left (a + b \sec ^{2}{\left (e + f x \right )}\right ) \cot ^{3}{\left (e + f x \right )}\, dx \]

[In]

integrate(cot(f*x+e)**3*(a+b*sec(f*x+e)**2),x)

[Out]

Integral((a + b*sec(e + f*x)**2)*cot(e + f*x)**3, x)

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.91 \[ \int \cot ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {a \log \left (\sin \left (f x + e\right )^{2}\right ) + \frac {a + b}{\sin \left (f x + e\right )^{2}}}{2 \, f} \]

[In]

integrate(cot(f*x+e)^3*(a+b*sec(f*x+e)^2),x, algorithm="maxima")

[Out]

-1/2*(a*log(sin(f*x + e)^2) + (a + b)/sin(f*x + e)^2)/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 146 vs. \(2 (30) = 60\).

Time = 0.31 (sec) , antiderivative size = 146, normalized size of antiderivative = 4.56 \[ \int \cot ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {4 \, a \log \left (\frac {{\left | -\cos \left (f x + e\right ) + 1 \right |}}{{\left | \cos \left (f x + e\right ) + 1 \right |}}\right ) - 8 \, a \log \left ({\left | -\frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 1 \right |}\right ) - \frac {{\left (a + b + \frac {4 \, a {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1}\right )} {\left (\cos \left (f x + e\right ) + 1\right )}}{\cos \left (f x + e\right ) - 1} - \frac {a {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1}}{8 \, f} \]

[In]

integrate(cot(f*x+e)^3*(a+b*sec(f*x+e)^2),x, algorithm="giac")

[Out]

-1/8*(4*a*log(abs(-cos(f*x + e) + 1)/abs(cos(f*x + e) + 1)) - 8*a*log(abs(-(cos(f*x + e) - 1)/(cos(f*x + e) +
1) + 1)) - (a + b + 4*a*(cos(f*x + e) - 1)/(cos(f*x + e) + 1))*(cos(f*x + e) + 1)/(cos(f*x + e) - 1) - a*(cos(
f*x + e) - 1)/(cos(f*x + e) + 1) - b*(cos(f*x + e) - 1)/(cos(f*x + e) + 1))/f

Mupad [B] (verification not implemented)

Time = 19.27 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.59 \[ \int \cot ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {a\,\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )}{2\,f}-\frac {a\,\ln \left (\mathrm {tan}\left (e+f\,x\right )\right )}{f}-\frac {{\mathrm {cot}\left (e+f\,x\right )}^2\,\left (\frac {a}{2}+\frac {b}{2}\right )}{f} \]

[In]

int(cot(e + f*x)^3*(a + b/cos(e + f*x)^2),x)

[Out]

(a*log(tan(e + f*x)^2 + 1))/(2*f) - (a*log(tan(e + f*x)))/f - (cot(e + f*x)^2*(a/2 + b/2))/f